#include<bits/stdc++.h>
using namespace std;
#define inc(i,l,r) for(int i=l;i<=r;++i)
#define dec(i,r,l) for(int i=r;i>=l;--i) 
const int N = 505;
int n, k, len, l, r, num, ans;
char x[N];
int ver(int now){
	if(now == len) return 1;
	if(x[now] == '(') l++, num = 0;
	if(x[now] == ')') l--, num = 0;
	if(l < 0) return 0;
	if(x[now] == '*') num++;
	if(num > k) return 0;
	return ver(now+1);
}
void search(int now) {
	if(now == len) {l = 0; r = 0;  num = 0; ans += ver(0); return;}
	else if(x[now] == '?') {
		x[now] = '*';	search(now+1);
		x[now] = '(';   search(now+1);
		x[now] = ')';   search(now+1);
	}
	else search(now+1);
}
int main(){
	freopen("bracket.in", "r", stdin);
	freopen("bracket.out", "w", stdout);
	cin >> n >> k;    cin >> x;   len = strlen(x);
	if(x[0] != '(') {
		if(x[0] != '?') {cout << 0; return 0;}
		x[0] = '(';
	}
	if(x[len-1] != ')') {
		if(x[len-1] != '?') {cout << 0; return 0;}
		x[len-1] = ')';
	} //cout << ans << endl;
	search(1);      cout << ans << endl;
	return 0;
}
